﻿using DayuCode.Designer.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DayuCode.Designer.Service
{
    public class SourceCodeHandler
    {
        private static string getBaseUrl(string methodName)
        {
            return AppInstance.ApiServer + "api/base/dayucode_sourceCodeHandler/" + methodName;
        }

		/// <summary>
		/// 
		/// </summary>
		/// <param name="funcId"></param>
		/// <param name="codeType">java vue app_uniapp pad_uniapp app_android app_ois</param>
		/// <returns></returns>
		public static IList<SourceCode> generateCodes(long funcId,string terminalType, long pageLayoutId, string codeType)
		{
			IList<SourceCode> obj = QHttpClient.Post<List<SourceCode>>(getBaseUrl("generateCodes"), new { funcId = funcId, terminalType = terminalType, pageLayoutId = pageLayoutId, codeType = codeType });
			return obj;
		}

		public static string testVueCode(long funcId)
		{
			string obj = QHttpClient.Post<String>(getBaseUrl("testVueCode"), new { funcId = funcId });
			return obj;
		}

		public static string testJavaCode(long funcId)
		{
			string obj = QHttpClient.Post<String>(getBaseUrl("testJavaCode"), new { funcId = funcId });
			return obj;
		}
	}
}
